/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author cegarciaa
 */
@Entity
@Table(name = "varfd")
@NamedQueries({@NamedQuery(name = "Varfd.findAll", query = "SELECT v FROM Varfd v"), @NamedQuery(name = "Varfd.findByIddispositivo", query = "SELECT v FROM Varfd v WHERE v.varfdPK.iddispositivo = :iddispositivo"), @NamedQuery(name = "Varfd.findByIdvarf", query = "SELECT v FROM Varfd v WHERE v.varfdPK.idvarf = :idvarf"), @NamedQuery(name = "Varfd.findByDato", query = "SELECT v FROM Varfd v WHERE v.dato = :dato")})
public class Varfd implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected VarfdPK varfdPK;
    @Column(name = "DATO")
    private Float dato;
    @JoinColumn(name = "IDVARF", referencedColumnName = "IDVARF", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Variablef variablef;
    @JoinColumn(name = "IDDISPOSITIVO", referencedColumnName = "IDDISPOSITIVO", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Dispositivo dispositivo;

    public Varfd() {
    }

    public Varfd(VarfdPK varfdPK) {
        this.varfdPK = varfdPK;
    }

    public Varfd(long idvarf, long iddispositivo) {
        this.varfdPK = new VarfdPK(idvarf, iddispositivo);
    }

    public VarfdPK getVarfdPK() {
        return varfdPK;
    }

    public void setVarfdPK(VarfdPK varfdPK) {
        this.varfdPK = varfdPK;
    }

    public Float getDato() {
        return dato;
    }

    public void setDato(Float dato) {
        this.dato = dato;
    }

    public Variablef getVariablef() {
        return variablef;
    }

    public void setVariablef(Variablef variablef) {
        this.variablef = variablef;
    }

    public Dispositivo getDispositivo() {
        return dispositivo;
    }

    public void setDispositivo(Dispositivo dispositivo) {
        this.dispositivo = dispositivo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (varfdPK != null ? varfdPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Varfd)) {
            return false;
        }
        Varfd other = (Varfd) object;
        if ((this.varfdPK == null && other.varfdPK != null) || (this.varfdPK != null && !this.varfdPK.equals(other.varfdPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Varfd[varfdPK=" + varfdPK + "]";
    }

}
